.TH std::experimental::simd::operator[] 3 "2024.06.10" "http://cppreference.com" "C++ Standard Libary"
.SH NAME
std::experimental::simd::operator[] \- std::experimental::simd::operator[]

.SH Synopsis
   reference operator[]( std::size_t i );        \fB(1)\fP (parallelism TS v2)
   value_type operator[]( std::size_t i ) const; \fB(2)\fP (parallelism TS v2)

   The subscript operators allow reading and writing single elements of a simd.

   1) Returns a reference proxy to the i-th element. This proxy type should not be
   captured into an lvalue. Lvalues of simd::reference can only convert to value_type.
   Rvalues of simd::reference overload assignment and all compound assignment operators
   as well as swap.
   2) Returns a prvalue of the i-th element. In contrast to containers, which contain
   objects of type value_type, a simd is not a container of individual objects and
   therefore cannot return an lvalue-reference.

.SH Parameters

   i - the element index. Required to be less than size()

.SH Example


// Run this code

 #include <cstddef>
 #include <cstdint>
 #include <experimental/simd>
 #include <iostream>
 namespace stdx = std::experimental;

 int main()
 {
     const stdx::native_simd<std::int64_t> a = 3;
     for (std::size_t i = 0; i != a.size(); ++i)
         std::cout << a[i] << ' ';
     std::cout << '\\n';
 }

.SH Possible output:

 3 3 3 3 3 3 3 3
